<template>
  <div class="container p-5 shadow">
    <div class="form-group">
      <label for="">账号：</label>
      <input type="text" class="form-control" name="" id=""  v-model="loginForm.acc" aria-describedby="helpId" placeholder="">
    </div>
    <div class="form-group">
      <label for="">密码：</label>
      <input type="text" class="form-control" name="" id=""  v-model="loginForm.pwd" aria-describedby="helpId" placeholder="">
    </div>
    <button type="button" class="btn btn-outline-primary col-12 mt-3"  @click="handler">登录</button>
  </div>

 <!--  <RouterLink to="/home">登录</RouterLink> -->

</template>

<script setup>
import { addMenus } from './tools';
import { ref } from 'vue';
import { useRouter, useRoute } from 'vue-router';

// 获取路由对象
const router = useRouter();

// 获取路由单元对象
const route = useRoute();

const loginForm = ref({
  acc:'',
  pwd:''
});


const handler = e => {
  // 事件处理函数中执行 push | replace

  // console.log('router=>', router);
  // console.log('route=>', route);
  
  // 执行导航
  // router.push('/home');
  addMenus('Home', router, loginForm.value.acc);
  router.replace('/home');

}

</script>

<style lang="scss" scoped>

</style>